Spring Boot 热加载 | 您所在的位置:网站首页 › spring boot classes › Spring Boot 热加载 |
热部署:在Tomcat运行时,监测到webapps下的web文件夹有变化,会进行重新部署项目。 热加载:在Tomcat运行时,当监测到WEB-INF/classes目录下的文件或者WEB-INF/lib目录下的jar包添加、删除、修改都会触发热加载。 一. 修改Idea配置备注:仅限于:Debugger模式下更新方法体
修改Idea配置
开启Build project automatically
使用快捷键:Ctrl + Alt + Shift + / 调出 Registry 窗口,勾选 compiler.automake.allow.when.app.running 选项
Maven依赖和插件 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-devtools runtime true org.springframework.boot spring-boot-maven-plugin 禁用 # 方法一:修改application.properties配置: 默认true,启用 spring.devtools.restart.enabled=false # 方法二:启动方法中添加配置 public static void main(String[] args) { System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(MyApplication.class, args); } 三 JReble插件 IDEA->File->Settings->Plugins->Marketplace->JRebel->安装 访问生成 GUID 的网址,https://www.guidgen.com/,生成新序列 将生成好的 GUID 字符串拼接到网址:https://jrebel.qekang.com/ 后面(好用) IDEA->Help->Jrebel->Activation 在第一个输入框中输入拼接好的在线激活服务,在第二个输入框中随便输入一个邮箱地址(符合格式的邮箱都可以) 最后点击Change license按钮即可激活,如果激活不成功,可以用上面说的那个在线生成GUID的网站再生成一个新的GUID再试一次。 由于上面是在线激活的,如果断开网络就不能正常使用 JRebel 了。因此,我们还需要设置 JRebel 离线模式。 |
CopyRight 2018-2019 实验室设备网 版权所有 |